package alittlepond.config;

import java.util.HashMap;
import java.util.Map;

public abstract class PropertyHaver<T extends Property> implements HasProperties<T>{

	private Map<T, Object> properties = new HashMap<T, Object>();
	
	public PropertyHaver() {
		for (T prop : getPropertyDefinitions()) {
			setProperty(prop, prop.getDefaultValue());
		}
	}
	
	@Override
	public Map<T, Object> getProperties() {
		return new HashMap<T, Object>(properties);
	}

	@Override
	public Object getProperty(T property) {
		return properties.get(property);
	}

//	@Override
//	public Collection<T> getPropertyDefinitions() {
//		// TODO Auto-generated method stub
//		return null;
//	}

	@Override
	public void setProperty(T property, Object value) {
		properties.put(property, value);
	}
	

}
